package com.tensquare.jwt;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;

/**
 * @Auther: hjk
 * @Date: 2019/6/22 22:40
 * @Description:
 */
public class CreateJwt {

    public static void main(String[] args) {
        JwtBuilder jwtBuilder = Jwts.builder().setId("666")
                .setSubject("hjk")
                .setIssuedAt(new Date())
                .signWith(SignatureAlgorithm.HS256,"screat")
                .setExpiration(new Date(new Date().getTime()+60000));
        //eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2NjYiLCJzdWIiOiJoamsiLCJpYXQiOjE1NjEyMTQ2NjJ9.VQHkacBbnYsNLTzRbXSOgHNrgHJe-UtkHBH4l1nv1M4
        System.out.println("===="+jwtBuilder.compact());
    }
}

